<template>
    <div class="userReport-view">
        <div><TissueTree v-on:tissueIdla="tissueIdla"></TissueTree></div>
        <div class="userReport-view-list">
            <div class="cotent-botton">
                <div class="cotent-botton-input">
                        <div class="cotent-botton-input-title">消费时间</div>
                        <el-date-picker
                                v-model="timevalue"
                                type="daterange"
                                range-separator="至"
                                start-placeholder="开始日期"
                                end-placeholder="结束日期">
                        </el-date-picker>
                </div>
                <div class="cotent-botton-botton-one" @click="queryInfo">查 询</div>
                <div class="cotent-botton-botton-two" @click="emptyingInfo">清 空</div>
                <div class="cotent-botton-botton-two" @click="emptyingInfo">导 出</div>
            </div>
            <div>
                <UserList :headlist="headlist" :contentlist="list" @selectList="selectList"></UserList>
                <Pagination :totalpag="totalpag" v-on:currentpage="currentpage"></Pagination>
            </div>
        </div>

    </div>
</template>

<script>
    import TissueTree from '../common/TissueTree';
    import UserList from '../common/user/UserList';
    import Pagination from '../common/Pagination';
    export default {
        name: "userReport",
        data(){
            return{
                organizationId: this.$store.getters.userData.userMsg.id,//组织id
                timevalue:[],
                totalpag:0,
                list:[],
                current:1,
                selectLists:"",
                headlist:{
                    checkout:true,
                    operation:{
                        type:false,
                        fromurl:"userReport",
                    },
                    list:[
                        {
                            prop:"id",
                            label:"流水单号",
                            width:"150",
                        },{
                            prop:"agentName",
                            label:"经纪人",
                            width:"120",
                        },{
                            prop:"agentMobile",
                            label:"联系电话",
                            width:"130",
                            // formatter:function(row, column, cellValue, index){
                            //     return organType(row.type)
                            // }
                        }
                        ,{
                            prop:"productsCount",
                            label:"主营区域",
                            width:"180",
                        } ,{
                            prop:"productsCount",
                            label:"所属组织",
                            width:"180",
                        }
                        ,{
                            prop:"lastUpdate",
                            label:"消费类型",
                            width:"120",
                        }
                        ,{
                            prop:"purchasePrice",
                            label:"消费金额",
                            width:"100",
                        }
                        ,{
                            prop:"createTime",
                            label:"流水时间",
                            width:"200",
                        }
                    ]},

            }
        },
        components: {
            TissueTree,
            UserList,
            Pagination,

        },
        mounted(){
            this.getlist();
        },
        methods: {
            //查询
            queryInfo(){
                if (this.timevalue==[]) {
                    this.$message({
                        message: '没有输入或选择查询内容',
                        type: 'warning'
                    });
                }else {
                    this.getlist()
                }
            },
            //清空
            emptyingInfo(){
                this.timevalue=[]
                this.getlist();
            },
            selectList(val){
                this.selectLists=val
            },
            tissueIdla(val){
                this.organizationId=val;//获取组织id
                this.getlist();
                console.log("memememeemggggggggggggggg",val)
            },
            currentpage(currentpage){
                console.log("当前页1111111111，",currentpage)
                this.current=currentpage
                this.getlist();
            },
            getlist(){
                let _this = this;
                let params={
                    current:_this.current,
                    size:10,
                    distributorId:this.organizationId,
                    beginTime:this.timevalue?this.timevalue[0]:"",
                    endTime:this.timevalue?this.timevalue[1]:"",
                }
                console.log("pppppppppppppppppppp",params)
                _this.Api.setting.distrReportList(params).then((data)=>{
                    console.log("你你你您你你你",data)
                    _this.totalpag=data.data.total;
                    _this.list=data.data.records;
                })
            }
        }
    }
</script>

<style scoped  rel="stylesheet/scss" lang="scss">
.userReport-view{
    display: flex;
    .userReport-view-list{
        margin-top: 24px;
        margin-left: 24px;
        padding: 24px;
        background-color: #ffffff;
        .cotent-botton{
            display: flex;
            margin-bottom: 24px;
            .cotent-botton-input{
                width:300px;
                height:32px;
                margin-right: 16px;
                display: flex;
                .cotent-botton-input-title{
                    align-self: center;
                    margin-right: 5px;
                    font-size:14px;
                    font-family:PingFangSC-Regular;
                    font-weight:400;
                    color:rgba(0,0,0,1);
                }

            }
            .cotent-botton-botton-one{
                width:65px;
                height:32px;
                line-height: 32px;
                text-align: center;
                background:rgba(24,144,255,1);
                border-radius:4px;
                font-size:14px;
                font-family:PingFangSC-Regular;
                font-weight:400;
                color:rgba(255,255,255,1);
                margin-right: 16px;
                cursor: pointer;
            }
            .cotent-botton-botton-two{
                width:65px;
                height:32px;
                line-height: 32px;
                background:rgba(255,255,255,1);
                border-radius:4px;
                border:1px #D9D9D9 solid;
                font-size:14px;
                font-family:PingFangSC-Regular;
                font-weight:400;
                color:rgba(0,0,0,0.65);
                text-align: center;
                margin-right: 16px;
                cursor: pointer;
            }
            .cotent-botton-botton-two2{
                width:88px;
                height:32px;
                line-height: 32px;
                background:rgba(255,255,255,1);
                border-radius:4px;
                border:1px #D9D9D9 solid;
                font-size:14px;
                font-family:PingFangSC-Regular;
                font-weight:400;
                color:rgba(0,0,0,0.65);
                text-align: center;
                margin-right: 16px;
                cursor: pointer;
            }
        }
    }
}
</style>